package com.ls.common.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.baomidou.mybatisplus.core.enums.IEnum;

/**
 * @Author lisheng
 * @Date 2025/05/07 16:05
 **/
public enum LeaveType implements IEnum<Integer> {
    SICK(1, "病假"),
    MATTER(2, "事假"),
    ANNUAL(3, "年假"),
    MATERNITY(4, "产假"),
    MARRIAGE(5, "婚假");

    @EnumValue  // 标记此字段为数据库存储值
    private final Integer code;
    private final String value;

    LeaveType(Integer code, String value) {
        this.code = code;
        this.value = value;
    }

    @Override
    public Integer getValue() {
        return this.code;  // 存到数据库的是数字
    }

    public String getDisplayValue() {
        return this.value; // 用于前端显示
    }
}